<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* p:nth-of-type(1) {
        color: red;
      }

      p:nth-of-type(even) {
        color: blue;
      }
      p:nth-of-type(odd) {
        color: green;
      } */

      .container > p {
        color: red;
      }
    </style>
  </head>
  <body class="container">
    <p>吃饭</p>
    <div>
      <span>111</span>
      <p>吃饭</p>
      <p>睡觉</p>
      <p>打豆豆</p>
    </div>

    <hr />

    <div>
      <span>222</span>
      <p>吃饭</p>
      <p>睡觉</p>
      <p>打豆豆</p>
    </div>
  </body>
</html>
